package net.aiion.weave.impl.xml.events;

import net.aiion.weave.spi.xml.XmlQualifiedName;
import net.aiion.weave.spi.xml.events.AttributeXmlEvent;

public class AttributeXmlEventImpl extends XmlEventImpl implements AttributeXmlEvent
{
    private final XmlQualifiedName xmlQualifiedName;
    private final String value;

    public AttributeXmlEventImpl(final XmlQualifiedName anXmlQualifiedName, final String aValue) {
        xmlQualifiedName = anXmlQualifiedName;
        value = aValue;
    }

    @Override
    public int getType() {
        return ATTRIBUTE;
    }

    @Override
    public XmlQualifiedName getName() {
        return xmlQualifiedName;
    }

    @Override
    public String getLocalName() {
        return xmlQualifiedName.getLocalName();
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder();
        builder.append("XmlAttributeImpl[xmlQualifiedName=");
        builder.append(xmlQualifiedName);
        builder.append(", value=");
        builder.append(value);
        builder.append("]");
        return builder.toString();
    }
}
